﻿<%@ Page Title="" Language="C#" MasterPageFile="~/manager/page/ManagerMasterPage.Master" AutoEventWireup="true" CodeBehind="etc.aspx.cs" Inherits="Com.Web.coffinegurunaru.manager.advertise.etc" %>
<%@ Register TagPrefix="UC" TagName="Menu" Src="~/manager/advertise/menu.ascx" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="phContent" runat="server">




<hr />
<br />
<table width="100%" border="0">
<tr>
	<td valign="top" width="60">
		<UC:Menu ID="Menu1" SubPageType=4 runat="server" />
	</td>
	<td style="width:20px;"></td>
	<td valign="top">






		<div id="m_Create">
		<table  cellpadding="0" cellspacing="1" style="background-color:Gray;">
			<tr>
				<td style="background-color:#FFFFFF; text-align:center; height:30px; " colspan="2">등록</td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; width:100px;">제목</td>
				<td style="background-color:#FFFFFF; text-align:left; width:800px;"><input type="text" style="width:500px" class="m_Title" value=""/></td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; ">뮤비제목</td>
				<td style="background-color:#FFFFFF; text-align:left; "><input type="text" style="width:500px" class="m_ListTitle" /></td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; ">썸네일</td>
				<td style="background-color:#FFFFFF; text-align:left; "><input type="text" style="width:500px" class="m_ThumbURL" readonly="readonly" />&nbsp;<input type="button" class="m_btnThumb" value="업로드" /></td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; ">이미지1</td>
				<td style="background-color:#FFFFFF; text-align:left; "><input type="text" style="width:500px" class="m_ImageURL" readonly="readonly" />&nbsp;<input type="button" class="m_btnImageURL" value="업로드" /></td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; ">이미지2</td>
				<td style="background-color:#FFFFFF; text-align:left; "><input type="text" style="width:500px" class="m_ImageURL2" readonly="readonly" />&nbsp;<input type="button" class="m_btnImage2URL" value="업로드" /></td>
			</tr>
			<tr>
				<td style="background-color:#eeeeee; text-align:center; ">이미지3</td>
				<td style="background-color:#FFFFFF; text-align:left; "><input type="text" style="width:500px" class="m_ImageURL3" readonly="readonly" />&nbsp;<input type="button" class="m_btnImage3URL" value="업로드" /></td>
			</tr>
			<tr style="display:none;">
				<td style="background-color:#eeeeee; text-align:center; ">내용</td>
				<td style="background-color:#FFFFFF; text-align:left; ">
					<textarea cols="80" rows="5" class="m_Content"></textarea>
				</td>
			</tr>
			<tr>
				<td style="background-color:#FFFFFF; text-align:center; " colspan="2"><input type="button" class="m_Confirm" value="저장" /></td>
			</tr>
		</table>
		</div>
		<div id="m_Modify" style="display:none;"></div>

<br />
		<table><tr><td style="text-align:center;" id="m_ListMain">
		<div id="m_List">
		
		</div>
		<div id="m_Pager"></div>
		</td></tr></table>
	
<script language="javascript" type="text/javascript">
(function($) {
	$.Advertise = {};
	
	$.Advertise = {
		Init : function() {
			$("#m_Create input.m_Confirm").click(function() {
				$.Advertise.Create();
				return false;
			});
			
			$("#m_Create input.m_btnThumb").click(function() {
				$.manager.fileopen(13, "$.Advertise.Callback_Thumb");
				return false;
			});
			
			$("#m_Create input.m_btnImageURL").click(function() {
				$.manager.fileopen(14, "$.Advertise.Callback_Image");
				return false;
			});
			
			$("#m_Create input.m_btnImage2URL").click(function() {
				$.manager.fileopen(14, "$.Advertise.Callback_Image2");
				return false;
			});
			$("#m_Create input.m_btnImage3URL").click(function() {
				$.manager.fileopen(14, "$.Advertise.Callback_Image3");
				return false;
			});
			$("#m_Create input.m_btnImage4URL").click(function() {
				$.manager.fileopen(14, "$.Advertise.Callback_Image4");
				return false;
			});
			$("#m_Create input.m_btnImage5URL").click(function() {
				$.manager.fileopen(14, "$.Advertise.Callback_Image5");
				return false;
			});
			
			$("#m_Pager").pager({
				pageSize : 10,
				useCallback : true,
				pageNo : 1,
				callback:function(pageNo) {
					$.Advertise.GetList();
				}
			});
			
			$.Advertise.GetList();
		},
		
		Callback_Thumb : function( url ) {
			$("#m_Create input.m_ThumbURL").val( url );
		},
		
		Callback_Image : function( url ) {
			$("#m_Create input.m_ImageURL").val( url );
		},
		
		Callback_Image2 : function( url ) {
			$("#m_Create input.m_ImageURL2").val( url );
		},
		
		Callback_Image3 : function( url ) {
			$("#m_Create input.m_ImageURL3").val( url );
		},
		
		Callback_Image4 : function( url ) {
			$("#m_Create input.m_ImageURL4").val( url );
		},
		
		Callback_Image5 : function( url ) {
			$("#m_Create input.m_ImageURL5").val( url );
		},
		
		Callback_Modify_Thumb : function( url ) {
			$("#m_Modify input.m_ThumbURL").val( url );
		},
		
		Callback_Modify_Image : function( url ) {
			$("#m_Modify input.m_ImageURL").val( url );
		},
		
		Callback_Modify_Image2 : function( url ) {
			$("#m_Modify input.m_ImageURL2").val( url );
		},
		
		Callback_Modify_Image3 : function( url ) {
			$("#m_Modify input.m_ImageURL3").val( url );
		},
		
		Callback_Modify_Image4 : function( url ) {
			$("#m_Modify input.m_ImageURL4").val( url );
		},
		
		Callback_Modify_Image5 : function( url ) {
			$("#m_Modify input.m_ImageURL5").val( url );
		},
		
		GetList : function() {
			$("#m_Create").ajaxNet(
			"/manager/advertise/advertisemethod.aspx?_vb=GetList",
			{
				"CategoryNo" : 4
			,	"PageNo" : $("#m_Pager").pager("option", "currentPageNo")
			,	"PageSize" : $("#m_Pager").pager("option", "pageSize")
			}, function(results, context)
			{
				$("#m_List").html( results[ 0 ] );
				$("#m_Pager").pager("update", results[1]);
				
				$("#m_List input.m_btnModify").click(function() {
					$.Advertise.Info( this );
				});
				
				$("#m_List input.m_btnRemove").click(function() {
					if ( confirm("정말로 삭제하시겠습니까?") ) {
						var AdvertiseNo = $(this).closest("tr").tagdata().AdvertiseNo;
						$("#m_List").ajaxNet(
						"/manager/advertise/advertisemethod.aspx?_vb=Remove",
						{
							"AdvertiseNo" : AdvertiseNo
						}, function(results, context)
						{
							$.Advertise.GetList();
						});
					}
				});
			});
		},
		
		CreateShow : function () {
			$("#m_Create").show();
			$("#m_Modify").hide();
		},
		
		Info : function( elem ) {
			var $tr = $(elem).closest("tr");
			var data = $tr.tagdata();
			var AdvertiseNo = data.AdvertiseNo;
			
			$("#m_Modify").ajaxNet(
			"/manager/advertise/advertisemethod.aspx?_vb=GetInfo",
			{
				"AdvertiseNo" : AdvertiseNo
			}, function(results, context)
			{
				$("#m_Create").hide();
				$("#m_Modify").show();
				$("#m_Modify").html( results );
				$("#m_Modify input.m_Cancel").click(function() {
					$.Advertise.CreateShow();
				});
				
				$("#m_Modify input.m_Confirm").click(function() {
					$.Advertise.Modify(AdvertiseNo);
				});
				
				$("#m_Modify input.m_btnThumb").click(function() {
					$.manager.fileopen(13, "$.Advertise.Callback_Modify_Thumb");
					return false;
				});
				

				$("#m_Modify input.m_btnMovie").click(function() {
					$.manager.fileopen(15, "$.Advertise.Callback_Modify_Image");
					return false;
				});
				
				$("#m_Modify input.m_btnMovie2").click(function() {
					$.manager.fileopen(15, "$.Advertise.Callback_Modify_Image2");
					return false;
				});
				
				$("#m_Modify input.m_btnMovie3").click(function() {
					$.manager.fileopen(15, "$.Advertise.Callback_Modify_Image3");
					return false;
				});
			});
		},
		
		Modify : function(AdvertiseNo) {
			var Title = $("#m_Modify input.m_Title").val();
			var ListTitle = $("#m_Modify input.m_ListTitle").val();
			var ThumbURL = $("#m_Modify input.m_ThumbURL").val();
			var ImageURL = $("#m_Modify input.m_ImageURL").val();
			var Content = $("#m_Modify textarea.m_Content").val();
			
			var Image2URL = $("#m_Modify input.m_ImageURL2").val();
			var Image3URL = $("#m_Modify input.m_ImageURL3").val();
			if ( Title == "" )
			{
				alert( "제목을 입력하세요" );
				return false;
			}
			
			if ( ListTitle == "" )
			{
				alert( "제목을 입력하세요" );
				return false;
			}
			
			if ( ThumbURL == "" )
			{
				alert( "쎔네일을 파일이 없습니다." );
				return false;
			}
			if ( ImageURL == "" )
			{
				alert( "파일이 없습니다." );
				return false;
			}
			
			$("#m_Modify").ajaxNet(
			"/manager/advertise/advertisemethod.aspx?_vb=ModifyEtc",
			{
				"AdvertiseNo" : AdvertiseNo
			,	"Title" : Title
			,	"ListTitle" : ListTitle
			,	"ThumbURL" : ThumbURL
			,	"ImageURL" : ImageURL
			,	"Content" : Content
			,	"Image2URL" : Image2URL
			,	"Image3URL" : Image3URL
			}, function(results, context)
			{
				location.href = location.href;
			});
		},
		
		Create : function() {
			var Title = $("#m_Create input.m_Title").val();
			var ListTitle = $("#m_Create input.m_ListTitle").val();
			var ThumbURL = $("#m_Create input.m_ThumbURL").val();
			var ImageURL = $("#m_Create input.m_ImageURL").val();
			var Content = $("#m_Create textarea.m_Content").val();
			
			var Image2URL = $("#m_Create input.m_ImageURL2").val();
			var Image3URL = $("#m_Create input.m_ImageURL3").val();
			
			if ( Title == "" )
			{
				alert( "제목을 입력하세요" );
				return false;
			}
			
			if ( ListTitle == "" )
			{
				alert( "제목을 입력하세요" );
				return false;
			}
			
			if ( ThumbURL == "" )
			{
				alert( "쎔네일을 파일이 없습니다." );
				return false;
			}
			
			if ( ThumbURL == "" )
			{
				alert( "파일이 없습니다." );
				return false;
			}
			
			$("#m_Create").ajaxNet(
			"/manager/advertise/advertisemethod.aspx?_vb=CreateEtc",
			{
				"Title" : Title
			,	"ListTitle" : ListTitle
			,	"ThumbURL" : ThumbURL
			,	"ImageURL" : ImageURL
			,	"Content" : Content
			,	"Image2URL" : Image2URL
			,	"Image3URL" : Image3URL
			}, function(results, context)
			{
				location.href = location.href;
			});
		}
	}
	
	$(function() {
		$.Advertise.Init();
	});
})(jQuery);

</script>





	</td>
</tr>
</table>


</asp:Content>
